<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "shbb_batch_detail".
 *
 * @property integer $id
 * @property integer $batch_id
 * @property integer $target_aim_id
 * @property string $target_aim_value
 *
 * @property ShbbBatch $batch
 * @property ShbbTraceContent $targetAim
 */
class BatchDetail extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'shbb_batch_detail';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['batch_id', 'target_aim_id'], 'integer'],
            [['target_aim_value'], 'string', 'max' => 2000]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'batch_id' => 'Batch ID',
            'target_aim_id' => 'Target Aim ID',
            'target_aim_value' => 'Target Aim Value',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getBatch()
    {
        return $this->hasOne(ShbbBatch::className(), ['id' => 'batch_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTargetAim()
    {
        return $this->hasOne(ShbbTraceContent::className(), ['id' => 'target_aim_id']);
    }
}
